package com.masterclient.app.businessmodule.vipmodule.financial_management.activity;

import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.TextView;

import com.alibaba.android.arouter.facade.annotation.Autowired;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.alibaba.android.arouter.launcher.ARouter;
import com.eoner.baselib.activity.FCBaseActivity;
import com.eoner.baselib.widget.navgation.FCNavigationBar;
import com.eoner.managerlibrary.router.AroutePath;
import com.eoner.middlelib.router.map.FCRouterPath;
import com.masterclient.app.R;

import butterknife.BindView;
import butterknife.OnClick;

@Route(path = FCRouterPath.ORDER_PAY_SUCCESS)
public class PaySuccessActivity extends FCBaseActivity {

    @BindView(R.id.pay_success_desc)
    TextView paySuccessDesc;
    @BindView(R.id.pay_success_order_list)
    TextView paySuccessOrderList;
    @BindView(R.id.pay_success_home)
    TextView paySuccessHome;
    @BindView(R.id.pay_success_know)
    TextView paySuccessKnow;

    @Autowired(name = "is_lading")
    String isLading = "";

    //提现成功
    @Autowired(name = "msg")
    String msg;

    @Override
    protected int requireGetLayoutId() {
        return R.layout.activity_purchase_pay_success;
    }

    @Override
    protected void requireSetCustomNavigationBar(FCNavigationBar navigationBar) {
        navigationBar.setTitle("申请成功").setLineHidden(true);
    }

    @Override
    protected void requireInitUIAndData(Bundle savedInstanceState) {

        if (TextUtils.isEmpty(msg)) {
            if ("1".equals(isLading)) {
                paySuccessDesc.setText("恭喜你, 订单提仓成功!");
                paySuccessOrderList.setVisibility(View.GONE);
                paySuccessHome.setTextColor(getResources().getColor(R.color.white));
                paySuccessHome.setBackgroundColor(getResources().getColor(R.color.color_333333));
            }
        }else {
            paySuccessDesc.setText(msg);
            paySuccessHome.setVisibility(View.GONE);
            paySuccessOrderList.setVisibility(View.GONE);
            paySuccessKnow.setVisibility(View.VISIBLE);
        }

    }


    @OnClick({R.id.pay_success_order_list,R.id.pay_success_home,R.id.pay_success_know})
    void onClick(View view){
        switch (view.getId()){
            case R.id.pay_success_know:
                finish();
                break;
            case R.id.pay_success_order_list:
                //ARouter.getInstance().build(FCRouterPath.PURCHASE_ORDER_LIST).navigation();
               // finish();
                break;
            case R.id.pay_success_home:
                ARouter.getInstance().build(AroutePath.MAIN_ACTIVITY).navigation();
                finish();
                break;
        }
    }
}
